return {
    "Kurama622/llm.nvim",
    dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim" },
    cmd = { "LLMSesionToggle", "LLMSelectedTextHandler", "LLMAppHandler" },
    config = function()
        require("render-markdown").setup({
            restart_highlighter = true,
            heading = {
                enabled = true,
                sign = false,
                position = "overlay", -- inline | overlay
                icons = { "󰎤 ", "󰎧 ", "󰎪 ", "󰎭 ", "󰎱 ", "󰎳 " },
                signs = { "󰫎 " },
                width = "block",
                left_margin = 0,
                left_pad = 0,
                right_pad = 0,
                min_width = 0,
                border = false,
                border_virtual = false,
                border_prefix = false,
                above = "▄",
                below = "▀",
                backgrounds = {},
                foregrounds = {
                    "RenderMarkdownH1",
                    "RenderMarkdownH2",
                    "RenderMarkdownH3",
                    "RenderMarkdownH4",
                    "RenderMarkdownH5",
                    "RenderMarkdownH6",
                },
            },
            dash = {
                enabled = true,
                icon = "─",
                width = 0.5,
                left_margin = 0.5,
                highlight = "RenderMarkdownDash",
            },
            code = { style = "normal" },
        })
        local tools = require("llm.tools")

        require("llm").setup({
            max_tokens = 4096,
            -- url = "https://open.bigmodel.cn/api/paas/v4/chat/completions",
            -- model = "glm-4-flash",
            url = "https://api.deepseek.com/chat/completions",
            model = "deepseek-chat",
            api_type = "openai",
            prefix = {
                user = { text = "😃 ", hl = "Title" },
                assistant = { text = "⚡ ", hl = "Added" },
            },

            save_session = true,
            max_history = 15,
            chat_ui_opts = {
                size = {
                    width = "70%",
                    height = "80%",
                },
                history = {},
            },

            popwin_opts = {
                size = { height = 10, width = "40%" },
            },

        -- stylua: ignore
        keys = {
          -- The keyboard mapping for the input window.
          ["Input:Submit"]      = { mode = "n", key = "<cr>" },
          ["Input:Cancel"]      = { mode = "n", key = "<C-c>" },
          ["Input:Resend"]      = { mode = "n", key = "<C-r>" },

          -- only works when "save_session = true"
          -- ["Input:HistoryNext"] = { mode = "n", key = "<C-j>" },
          -- ["Input:HistoryPrev"] = { mode = "n", key = "<C-k>" },

          -- The keyboard mapping for the output window in "split" style.
          ["Output:Ask"]        = { mode = "n", key = "i" },
          ["Output:Cancel"]     = { mode = "n", key = "<C-c>" },
          ["Output:Resend"]     = { mode = "n", key = "<C-r>" },

          -- The keyboard mapping for the output and input windows in "float" style.
          -- ["Session:Toggle"]    = { mode = "n", key = "<leader>ac" },
          -- ["Session:Close"]     = { mode = "n", key = "<esc>" },
        },

            app_handler = {
                Ask = {
                    handler = tools.disposable_ask_handler,
                    opts = {
                        position = {
                            row = 2,
                            col = 0,
                        },
                        title = " Ask ",
                        inline_assistant = true,

                        -- display diff
                        display = {
                            mapping = {
                                mode = "n",
                                keys = { "d" },
                            },
                            action = nil,
                        },
                        -- accept diff
                        accept = {
                            mapping = {
                                mode = "n",
                                keys = { "Y", "y" },
                            },
                            action = nil,
                        },
                        -- reject diff
                        reject = {
                            mapping = {
                                mode = "n",
                                keys = { "N", "n" },
                            },
                            action = nil,
                        },
                        -- close diff
                        close = {
                            mapping = {
                                mode = "n",
                                keys = { "<esc>" },
                            },
                            action = nil,
                        },
                    },
                },
                OptimizeCode = {
                    handler = tools.side_by_side_handler,
                    opts = {
                        left = {
                            focusable = false,
                        },
                    },
                },

                Translate = {
                    handler = tools.qa_handler,
                    opts = {
                        component_width = "60%",
                        component_height = "50%",
                        query = {
                            title = " 󰊿 Trans ",
                            hl = { link = "Define" },
                        },
                        input_box_opts = {
                            size = "15%",
                            win_options = {
                                winhighlight = "Normal:Normal,FloatBorder:FloatBorder",
                            },
                        },
                        preview_box_opts = {
                            size = "85%",
                            win_options = {
                                winhighlight = "Normal:Normal,FloatBorder:FloatBorder",
                            },
                        },
                    },
                },
                WordTranslate = {
                    handler = tools.flexi_handler,
                    prompt = [[英译中，给出英文单词的音标，词性,中文意思，例句等信息]],
                    opts = {
                        exit_on_move = true,
                        enter_flexible_window = false,
                        enable_cword_context = true,
                    },
                },
            },
            spinner = {
                text = {
                    "",
                    "",
                    "",
                    "",
                },
                hl = "Title",
            },
        })
    end,
    keys = {
        { "<F1>", mode = { "n", "i" }, "<cmd>LLMSessionToggle<cr>", desc = "Toggle LLM Chat" },
        { "<space>ae", mode = "v", "<cmd>LLMSelectedTextHandler 请解释下面这段代码<cr>" },
        { "<space>dw", mode = "n", "<cmd>LLMAppHandler WordTranslate<cr>", desc = "Word Translate" },
        {
            "<space>df",
            mode = { "n", "v" },
            "<cmd>LLMSelectedTextHandler 英汉互译. 如果是一个英语单词，给出音标，词性, 例句等信息; 如果超过一个单词，翻译成中文；如果是中文，翻译成英文<cr>",
            desc = "translate",
        },

        {
            "<space>ed",
            mode = { "n", "v" },
            "<cmd>LLMSelectedTextHandler 给函数生成doxgen格式的中文注释, 不需要原函数之类的无关内容<cr>",
            desc = "ai生成c函数注释",
        },
        { "<space>at", mode = "n", "<cmd>LLMAppHandler Translate<cr>", desc = "AI Translator" },
        { "<space>ao", mode = "v", "<cmd>LLMAppHandler OptimizeCode<cr>", desc = "Optimize Code" },
    },
}
